package com.ruoyi.project.channel.vwPlatformDayStat.controller;

import java.math.BigDecimal;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.channel.vwPlatformDayStat.domain.VwPlatformDayStat;
import com.ruoyi.project.channel.vwPlatformDayStat.service.IVwPlatformDayStatService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * VIEW信息操作处理
 * 
 * @author zero
 * @date 2019-05-19
 */
@Controller
@RequestMapping("/channel/vwPlatformDayStat")
public class VwPlatformDayStatController extends BaseController
{
    private String prefix = "channel/view";
	
	@Autowired
	private IVwPlatformDayStatService vwPlatformDayStatService;
	
	@RequiresPermissions("channel:vwPlatformDayStat:view")
	@GetMapping()
	public String vwPlatformDayStat()
	{
	    return prefix + "/vwPlatformDayStat";
	}
	
	/**
	 * 查询VIEW列表
	 */
	@RequiresPermissions("channel:vwPlatformDayStat:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(VwPlatformDayStat vwPlatformDayStat)
	{
		startPage();
        List<VwPlatformDayStat> list = vwPlatformDayStatService.selectVwPlatformDayStatList(vwPlatformDayStat);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出VIEW列表
	 */
	@RequiresPermissions("channel:vwPlatformDayStat:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(VwPlatformDayStat vwPlatformDayStat)
    {
    	List<VwPlatformDayStat> list = vwPlatformDayStatService.selectVwPlatformDayStatList(vwPlatformDayStat);
        ExcelUtil<VwPlatformDayStat> util = new ExcelUtil<VwPlatformDayStat>(VwPlatformDayStat.class);
        return util.exportExcel(list, "vwPlatformDayStat");
    }
	
	/**
	 * 新增VIEW
	 */
	@GetMapping("/add")
	public String add()
	{
	    return prefix + "/add";
	}
	
	/**
	 * 新增保存VIEW
	 */
	@RequiresPermissions("channel:vwPlatformDayStat:add")
	@Log(title = "VIEW", businessType = BusinessType.INSERT)
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(VwPlatformDayStat vwPlatformDayStat)
	{		
		return toAjax(vwPlatformDayStatService.insertVwPlatformDayStat(vwPlatformDayStat));
	}

	/**
	 * 修改VIEW
	 */
	@GetMapping("/edit/{sumCash}")
	public String edit(@PathVariable("sumCash") BigDecimal sumCash, ModelMap mmap)
	{
		VwPlatformDayStat vwPlatformDayStat = vwPlatformDayStatService.selectVwPlatformDayStatById(sumCash);
		mmap.put("vwPlatformDayStat", vwPlatformDayStat);
	    return prefix + "/edit";
	}
	
	/**
	 * 修改保存VIEW
	 */
	@RequiresPermissions("channel:vwPlatformDayStat:edit")
	@Log(title = "VIEW", businessType = BusinessType.UPDATE)
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(VwPlatformDayStat vwPlatformDayStat)
	{		
		return toAjax(vwPlatformDayStatService.updateVwPlatformDayStat(vwPlatformDayStat));
	}
	
	/**
	 * 删除VIEW
	 */
	@RequiresPermissions("channel:vwPlatformDayStat:remove")
	@Log(title = "VIEW", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{		
		return toAjax(vwPlatformDayStatService.deleteVwPlatformDayStatByIds(ids));
	}
	
}
